\chapter{Introduction}

The chapter introduces some concepts about \tap and \gwt that are useful to
understand the techiniques that we propose in the following chapters.
This document is not specifically about one or the other frameworks, thus we
suggest to look at the official documentation, tutorials and resources available
for them.

\section{\tap}
\subsection{General idea of the approach}

\subsubsection{Pages, components, and componets again}

\subsubsection{IoC, Services, Injection}

\subsection{Request processing}

The TapestryFilter, Pipelines, Filters, FilterHandlers, Dispatcher, and so on
TapestryFilter receives all the incoming requests and rerout them to the rigth
HttpServletRequestHandler service (by invoking its service() method).

\paragraph{HttpServletRequestHandler} performs initial processing in a pipeline
that can be extended by contributing to the service's configuration.
The terminator concludes by:
	1- Storing the request and response into the {\bf RequestGlobal} service
	2- Bridging the ServletAPI with Tapestry. It does that by wrapping
	request/response into Request and Response (high level objects) and invoking
	the {\bf RequestHandler pipeline}.

\paragraph{RequestHandler} pipeline is abstracted to support non-servlet 
applications (e.g. Portlet). Accessing Request/Response service object is the way to obtain query
parameters and so on.
The pipeline contains at least the following services: CheckForUpdates,
Localization, StaticFiles, ErrorFilter.
The pipeline stores the Request/Response into {\bf RequestGlobals} and invoke
the {\bf MasterDispatch} service.

\paragraph{The MasterDispatch service}
is a chain-of-command (thus Ordered sequence) of several Dispatchers that
process a particular request:
RootPath, Asset, PageRender, ComponentEvent.

\subsection{Page Navigation}
Component event requests target a specific component on a specific page,
triggering an event within that component. They take the form of an
ActionLink, an EventLink, or a Form submission. The value returned from the
event handler will determine the response send to the client.

The URL for a component event request identifies the name of the page, the
nested id of the component, and the name of the event to trigger on the component
The request may contain additional context information, which will be provided
to the event handler method. (HOW ?!)

Render requests target a specific page, and
stream the HTML markup for that page back to the client

Pages may have an activation context, which can be provided either when the
render request is created (using the PageLink component) or asked to the page
itself via a Passivate event triggering (the return value is used as context).
Multiple objects must be encapsulated in arrays or lists. 
When the render request arrives, the onActivate method is called before the page
is rendered, to restore the internal state or to validate the access to the
page.

If the page contains some components and forms every one of the will call again
the onActivate method of the page, so all of them will have the same activation
context.
The activate method can return a value, which is used as component event
request.

\subsection{Component Events}
They represent requests initiated by the users. They represent also
a flow-of-control allowing notifications to container component and to collect
data from it. Usually an user request will spawn a number of flow-of-control
requests. Event handler methods (annotated as OnEvent or via naming convention)
listen for events. A single event handler method can process different events.

To avoid multiple listening of events the method must specify both the value of
the event and the component who generated it. The alternatives are to 
specify just the component or the event name.

The context values (the context parameter to the ActionLink component) can be
any object. However, only a simple conversion to string occurs.
{\it This is at URL level however}.

Whatever your value is (string, number, date), it is converted into a plain
string. If you have multiple context values (by binding a list or array of objects to
the Link's context parameter), then each one, in order, will be added to the
URL. When an event handler method is invoked, the strings are converted back into
values, or even objects. A {\bf ValueEncoder} is used to convert between client
side strings and server side objects and the ValueEncoderSource provides the
necessary value encoders.

An event handler method will only be invoked if the context contains at least as
many values as the method has parameters the other methods will be {\bf
silently} skipped. 

To designate that an event handler method should be invoked regardless of how
many context parameters are available, change the method to accept a single
parameter of type Object[], type List, or type EventContext.

\section{\Gwt}
Few words on GWT, the version, the basic idea, the important (for the
integration parts).

Entry Point

GWT RPC

Single module

